package cn.kivensoft.util;

/** 带错误码的异常类
 * @author Kiven Lee
 * @version 1.0
 * @since 2022-08-16
 */
public class CodeException extends Exception {

	private static final long serialVersionUID = 1L;

	private final int code;

	public CodeException(int code, String message, Throwable cause) {
		super(message, cause);
		this.code = code;
	}

	public CodeException(int code, String message) {
		super(message);
		this.code = code;
	}

	public CodeException(int code, String message, Object... args) {
		super(Fmt.fmt(message, args));
		this.code = code;
	}

	public CodeException(Throwable cause, int code, String message, Object... args) {
		super(Fmt.fmt(message, args), cause);
		this.code = code;
	}

	public int getCode() {
		return code;
	}

}
